package io;

import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("hw.txt");

        while (true){
            System.out.println("请输入内容：");
            String s = sc.next();
            if (s.equals("exit")){
                break;
            }
            fos.write(s.getBytes(StandardCharsets.UTF_8));
            fos.write(" ".getBytes(StandardCharsets.UTF_8));
        }
        System.out.println("写入完成");
        fos.close();
    }
}
